FROM alpine:latest
RUN apk --no-cache add nodejs npm python3 py3-pip supervisor


WORKDIR /usr/src/app

COPY requirements.txt ./

# 安装所需要的库
RUN python -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple/
RUN python -m pip install --upgrade pip
#RUN rm -f /usr/local/lib/python3.9/site-packages/typing_extensions*.dist-info
RUN pip install --no-cache-dir -r requirements.txt
RUN npm install jsdom
RUN npm install express
RUN npm install vm
#RUN yum install -y redis

# 安装 supervisord
RUN apt-get update && apt-get install -y supervisor && apt-get clean

# 复制 supervisord 配置文件
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf


# 需要用到的文件
COPY Akamai/utils.py /usr/src/app/akamai/utils.py
COPY Akamai/get_cookie.py /usr/src/app/akamai/get_cookie.py
COPY Akamai/6E_sensor.js /usr/src/app/akamai/6E_sensor.js
COPY Akamai/6E_flask.py /usr/src/app/akamai/6E_flask.py

# 启动 supervisord
CMD ["/usr/bin/supervisord"]
## 启动文件(接口)
#CMD ["python","/usr/src/app/akamai/6E_flask.py"]
## 启动 JS 文件
#CMD ["node", "/usr/src/app/akamai/6E_sensor.js"]

